package code;

public class Rorate_day03 {
    public static void main(String[] args) {
        int[][] matrix = {
                {1, 2, 3},
                {4, 5, 6},
                {7, 8, 9}
        };
        int[][] result = new int[matrix[0].length][matrix[0].length];
        for (int i = 0; i < matrix[0].length; i++) {
            for (int j = 0; j < matrix[0].length; j++) {
                result[i][j] = matrix[matrix[0].length-j-1][i];
            }
        }
        matrix=result;
        System.out.print("[");
        for (int i = 0; i < matrix[0].length; i++) {
            System.out.print("[");
            for (int j = 0; j < matrix[0].length; j++) {
                System.out.print(matrix[i][j]);
                if (j < matrix[0].length - 1) {
                    System.out.print(",");
                }
            }
            System.out.print("]");
            if (i < matrix.length - 1) {
                System.out.print(",");
            }
        }
        System.out.println("]");
    }

}
